package com.vision.sales.cl;

import com.google.gwt.core.client.GWT;
import com.vision.core.cl.Services;
import com.vision.core.cm.serv.rpc.CompanyService;
import com.vision.core.cm.serv.rpc.CompanyServiceAsync;
import com.vision.sales.cm.serv.rpc.AdvancePaymentService;
import com.vision.sales.cm.serv.rpc.AdvancePaymentServiceAsync;
import com.vision.sales.cm.serv.rpc.AppliedAdvancePaymentService;
import com.vision.sales.cm.serv.rpc.AppliedAdvancePaymentServiceAsync;
import com.vision.sales.cm.serv.rpc.CheckService;
import com.vision.sales.cm.serv.rpc.CheckServiceAsync;
import com.vision.sales.cm.serv.rpc.CollectionService;
import com.vision.sales.cm.serv.rpc.CollectionServiceAsync;
import com.vision.sales.cm.serv.rpc.CreditMemoService;
import com.vision.sales.cm.serv.rpc.CreditMemoServiceAsync;
import com.vision.sales.cm.serv.rpc.CustomerService;
import com.vision.sales.cm.serv.rpc.CustomerServiceAsync;
import com.vision.sales.cm.serv.rpc.DebitMemoService;
import com.vision.sales.cm.serv.rpc.DebitMemoServiceAsync;
import com.vision.sales.cm.serv.rpc.DeliveryReceiptService;
import com.vision.sales.cm.serv.rpc.DeliveryReceiptServiceAsync;
import com.vision.sales.cm.serv.rpc.MonthlyTotalsService;
import com.vision.sales.cm.serv.rpc.MonthlyTotalsServiceAsync;
import com.vision.sales.cm.serv.rpc.ProductService;
import com.vision.sales.cm.serv.rpc.ProductServiceAsync;
import com.vision.sales.cm.serv.rpc.SalesInvoiceService;
import com.vision.sales.cm.serv.rpc.SalesInvoiceServiceAsync;
import com.vision.sales.cm.serv.rpc.SalesmanService;
import com.vision.sales.cm.serv.rpc.SalesmanServiceAsync;

/**
 * 
 * @author Mark
 *
 */
public class SalesServices {
	
	private static CompanyServiceAsync companySvc;
	private static ProductServiceAsync productSvc;
	private static SalesmanServiceAsync salesmanSvc;
	private static CustomerServiceAsync customerSvc;
	private static CheckServiceAsync checkSvc;
	private static MonthlyTotalsServiceAsync monthlyTotalsSvc;
	
	private static DeliveryReceiptServiceAsync deliveryReceiptSvc;
	private static SalesInvoiceServiceAsync salesInvoiceSvc;
	private static CollectionServiceAsync collectionSvc;
	private static AdvancePaymentServiceAsync advancePaymentSvc;
	private static AppliedAdvancePaymentServiceAsync appliedAdvancePaymentSvc;
	private static CreditMemoServiceAsync creditMemoSvc;
	private static DebitMemoServiceAsync debitMemoSvc;

	public static CompanyServiceAsync companySvc() {
		if (companySvc == null)
			companySvc = Services.create(GWT.create(CompanyService.class));
		return companySvc;
	}
	
	public static CustomerServiceAsync customerSvc() {
		if (customerSvc == null)
			customerSvc = Services.create(GWT.create(CustomerService.class));
		return customerSvc;
	}
	
	public static SalesmanServiceAsync salesmanSvc() {
		if (salesmanSvc == null)
			salesmanSvc = Services.create(GWT.create(SalesmanService.class));
		return salesmanSvc;
	}
	
	public static ProductServiceAsync productSvc() {
		if (productSvc == null)
			productSvc = Services.create(GWT.create(ProductService.class));
		return productSvc;
	}

	public static AdvancePaymentServiceAsync advancePaymentSvc() {
		if (advancePaymentSvc == null)
			advancePaymentSvc = Services.create(GWT.create(AdvancePaymentService.class));
		return advancePaymentSvc;
	}
	
	public static AppliedAdvancePaymentServiceAsync appliedAdvancePaymentSvc() {
		if (appliedAdvancePaymentSvc == null)
			appliedAdvancePaymentSvc = Services.create(GWT.create(AppliedAdvancePaymentService.class));
		return appliedAdvancePaymentSvc;
	}

	public static CreditMemoServiceAsync creditMemoSvc() {
		if (creditMemoSvc == null)
			creditMemoSvc = Services.create(GWT.create(CreditMemoService.class));
		return creditMemoSvc;
	}

	public static DebitMemoServiceAsync debitMemoSvc() {
		if (debitMemoSvc == null)
			debitMemoSvc = Services.create(GWT.create(DebitMemoService.class));
		return debitMemoSvc;
	}
	
	public static CheckServiceAsync checkSvc() {
		if (checkSvc == null)
			checkSvc = Services.create(GWT.create(CheckService.class));
		return checkSvc;
	}
	
	public static MonthlyTotalsServiceAsync monthlyTotalsSvc() {
		return monthlyTotalsSvc == null ? (monthlyTotalsSvc = Services.create(GWT.create(MonthlyTotalsService.class))) : monthlyTotalsSvc;
	}

	public static CollectionServiceAsync collectionSvc() {
		if (collectionSvc == null)
			collectionSvc = Services.create(GWT.create(CollectionService.class));
		return collectionSvc;
	}

	public static DeliveryReceiptServiceAsync deliveryReceiptSvc() {
		if (deliveryReceiptSvc == null)
			deliveryReceiptSvc = Services.create(GWT.create(DeliveryReceiptService.class));
		return deliveryReceiptSvc;
	}

	public static SalesInvoiceServiceAsync salesInvoiceSvc() {
		if (salesInvoiceSvc == null)
			salesInvoiceSvc = Services.create(GWT.create(SalesInvoiceService.class));
		return salesInvoiceSvc;
	}
	
}
